<script setup lang='ts'>
// 自定义 规则
//interface Props {
//}

import { onMounted, ref, reactive, defineProps } from 'vue';
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll';
const { mescrollInit, downCallback, getMescroll } = useMescroll();
const props = defineProps({
    fixed: {
        type: Boolean,
        default: () => true
    },
    apiData: {
        type: Function,
        default: () => { }
    }
});
/**
 * @property 变量
 */


/**
 * @property  所有请求以api开头 如:apiDataInfo
 */
const apiList = () => {
    props.apiData({
        page: getMescroll().num,
        size: getMescroll().size,
    }, (size: number, hasNext: Boolean) => {
        getMescroll().endSuccess(size, hasNext)
    });
}

/**
 * @property 自定义事件 以事件名开头 如: clickButton,inputDev
 */
const upCallback = () => {
    apiList();
}

/**
 * @property 内置方法
 */


</script>
<template>
    <div class="w-[100%] h-[100%]">
        <mescroll-uni @down="downCallback" @up="upCallback" :fixed="props.fixed" :bottombar="false"
            @init="mescrollInit">
           <slot /> 
        </mescroll-uni>
    </div>
</template>
<style lang="scss" scoped></style>